﻿/*-------------------------------------------------------------------------
* 命名空间: SiliconSelect.Common/floatCalcHelper
* 类       名: floatCalcHelper
* 功      能:  浮点数计算类
* 时      间:  2023/9/17 13:05:29
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace SiliconSelect.Common
{
    public class FloatCalcHelper
    {
        /// <summary>
        /// 尺寸保留5位小数.
        /// </summary>
        /// <param name="originalVal"></param>
        /// <param name="offsetIndex"></param>
        /// <returns></returns>
        public static string SizeAddOffset(string originalVal, double[] arrayKb)
        {
            try
            {
                return (float.Parse(originalVal) * arrayKb[0] + arrayKb[1]).ToString("f5");
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogType.Exception, ExceptionHelper.GetFullException(ex, MethodBase.GetCurrentMethod()!));
                return originalVal;
            }
        }
    }
}
